package com.vr.cloudpicture.service;

import com.vr.cloudpicture.common.PageResult;
import com.vr.cloudpicture.model.dto.user.*;
import com.vr.cloudpicture.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.vr.cloudpicture.model.dto.user.UserLogin;
import com.vr.cloudpicture.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;

/**
* @author hzh
* @description 针对表【user(用户)】的数据库操作Service
* @createDate 2025-04-25 17:06:20
*/
public interface IUserService extends IService<User> {

    /**
     * 用户注册
     *
     * @param userRegisterRequest 用户注册请求
     * @return {@code Long } 结果
     */
    Long userRegister(UserRegisterRequest userRegisterRequest);

    /**
     * 注册
     *
     * @param userRegisterRequest 用户注册请求
     * @return {@code Long }
     */
    Long doRegister(UserRegisterRequest userRegisterRequest);

    /**
     * 用户登录
     *
     * @param userLoginRequest 用户登录请求
     * @param request          请求
     */
    String userLogin(UserLoginRequest userLoginRequest, HttpServletRequest request);

    /**
     * 获取当前登录用户
     *
     * @param request 请求
     * @return {@code UserLoginVO }
     */
    UserLogin getLoginUser(HttpServletRequest request);

    /**
     * 用户注销
     *
     * @param request 请求
     * @return {@code Boolean }
     */
    Boolean userLogout(HttpServletRequest request);

    /**
     * 分页查询用户
     *
     * @param userQueryRequest 用户查询请求
     * @return {@code PageResult<UserVO> }
     */
    PageResult<UserVO> pageQuery(UserQueryRequest userQueryRequest);

    /**
     * 更新用户
     *
     * @param userUpdateRequest 用户更新请求
     * @return {@code Boolean }
     */
    Boolean updateUser(UserUpdateRequest userUpdateRequest);

    /**
     * 保存用户
     *
     * @param userAddRequest 用户添加请求
     * @return Boolean
     */
    Boolean saveUser(UserAddRequest userAddRequest);

    /**
     * 兑换vip
     *
     * @param exchangeRequest 兑换请求
     * @param userLogin       用户登录
     * @return boolean
     */
    Boolean exchangeVip(VipExchangeRequest exchangeRequest,UserLogin userLogin);

    /**
     * 判断是否为管理员
     *
     * @param user 请求
     * @return boolean
     */
    boolean isAdmin( UserLogin user);

    /**
     * 获取脱敏后的用户信息
     *
     * @param id 用户id
     * @return {@code UserVO }
     */
    UserVO getUserVOById(Long id);
}
